<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      >
    <ui:composition template="Template.xhtml">
        <ui:define name="top">
            #{bundle.create}#{bundle.driver}

        </ui:define>
        <ui:define name="content">
            <!--<shiro:hasPermission name="user:C">--> 

            <f:event listener="#{driverCreateMB.precreateDriver()}"
                     type="preRenderView"></f:event>
            <h:form id="form"  >

                <p:panel>


                    <p:panelGrid styleClass="noborder left" columns="2"   >


                        <h:outputText value="#{bundle.loginName}" />
                        <p:inputText value="#{driverCreateMB.currentdriver.iduser.loginname}"   required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.loginName}"/>

                        <h:outputText value="#{bundle.username}" />
                        <p:inputText value="#{driverCreateMB.currentdriver.iduser.name}" required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.username}"  />

                        <h:outputText value="#{bundle.tel}" />
                        <p:inputText value="#{driverCreateMB.currentdriver.iduser.tel}"   required="true" requiredMessage="#{bundle.pleaseInput}#{bundle.tel}">
                            <p:ajax event="blur" listener="#{driverCreateMB.telvali()}" update=":growl"/>
                        </p:inputText>
                        <h:outputText value="#{bundle.depot}" />
 
                        <p:selectOneMenu id="depot" value="#{driverCreateMB.currentdriver.iddepot}" converter="#{depotConvert}">

                            <f:selectItems var="depot" value="#{driverCreateMB.depotlist}" itemValue="#{depot}" itemLabel="#{depot.name}"/>
                            <p:ajax event="change" listener="#{driverCreateMB.ondepotchange()}" update="vehicle" />
                        </p:selectOneMenu>
                        <h:outputText value="#{bundle.default}#{bundle.vehicle}" />
                        <p:selectOneMenu id="vehicle" value="#{driverCreateMB.currentdriver.idvehicle}" converter="#{vehicleConvert}" required="true"   requiredMessage="#{bundle.pleaseInput}#{bundle.vehicle}">
                            <f:selectItems  var="vehicle" value="#{driverCreateMB.vehiclelist}"  itemValue="#{vehicle}" itemLabel="#{vehicle.plate}" />
                        </p:selectOneMenu>



                    </p:panelGrid>

                    <p:panelGrid styleClass="noborder left"  style="width:100% " columns="1"   >

                        <p:commandButton value="#{bundle.conform}" validateClient="true" action="#{driverCreateMB.create()}"  update="@all">
                            <p:confirm header="#{bundle.conform}" message="#{bundle.conform}" icon="ui-icon-alert" />
                        </p:commandButton>
<!--                        <p:button value="#{bundle.back}"  outcome="list">

                        </p:button>-->
                    </p:panelGrid>
                    <p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
                        <p:commandButton value="#{bundle.yes}" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
                        <p:commandButton value="#{bundle.no}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
                    </p:confirmDialog>
                </p:panel>
            </h:form>




            <!--</shiro:hasPermission>-->
        </ui:define>
    </ui:composition>
</html>

